package com.bz.redis.controller;

import com.bz.redis.service.ItemCategoryService;
import com.bz.vo.CatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis/itemCategory")
public class ItemCategoryController {

    @Autowired
    private ItemCategoryService itemCategoryService;

    /**
     * 向Redis中添加缓存数据
     * @param catVo
     */
    @RequestMapping("/insertItemCategory")
    public void insertItemCategory(@RequestBody CatVo catVo){
        itemCategoryService.insertItemCategory(catVo);
    }

    /**
     * 查询Redis中缓存的首页商品分类
     * @return
     */
    @RequestMapping("/selectItemCategory")
    public CatVo selectItemCategory(){
        return itemCategoryService.selectItemCategory();
    }
}
